<template>
  <div class="notification-container">
    <i class="el-icon-arrow-left" @click="i1"></i>
    <div class="header">
      <h1>服务通知</h1>
    </div>
    <div class="notification-list">
      <div class="notification-item" v-for="(notification, index) in notifications" :key="index">
        <div class="notification-icon"></div>
        <div class="notification-content">
          <div class="notification-title">服务通知</div>
          <div class="notification-time">{{ notification.time }}</div>
          <div class="notification-message">{{ notification.msg }}</div>
        </div>
      </div>
    </div>
    <van-tabbar route>
      <van-tabbar-item replace to="/home" icon="home-o">首页</van-tabbar-item>
      <van-tabbar-item replace to="/NotificationList" icon="setting-o">消息</van-tabbar-item>
      <van-tabbar-item replace to="/mine" icon="friends-o">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<script>
import axios from "axios";

export default {
  data() {
    return {
      notifications: [],
    };
  },
  methods: {
    i1() {
      this.$router.push('/NotificationList');
    },
    list(){
      axios.get('/games/inform/list').then(res => {
        this.notifications = res.data;
        console.log(res.data);
      });
    },
  },
  created() {
    this.list();
  }
};
</script>

<style scoped>
.notification-container {
  padding: 20px;
  background-color: #f7f9fc;
  height: 100vh;
}

.header {
  text-align: center;
  margin-bottom: 20px;
}

.notification-list {
  margin-top: 20px;
  flex-grow: 1;
}

.notification-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #eaeaea;
  cursor: pointer; /* 鼠标指针样式 */
}

.notification-icon {
  width: 40px;
  height: 40px;
  background-color: #00aaff; /* 蓝色 */
  border-radius: 50%;
  margin-right: 10px;
}

.notification-content {
  flex-grow: 1;
}

.notification-title {
  font-weight: bold;
}

.notification-time {
  color: #999;
  font-size: 0.8em;
}

.notification-message {
  margin-top: 5px;
  width: 280px;
  float: right;
}

.footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #fff;
  border-top: 1px solid #eaeaea;
  box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.1);
}

.footer-icons {
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
}

.footer-icons li {
  list-style: none;
}

</style>
